﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local='clr-namespace:NczControlLibrary.Controls'
    xmlns:panel='clr-namespace:NczControlLibrary.Panels'
    xmlns:base='clr-namespace:NczControlLibrary'>
    <ItemsPanelTemplate x:Key='defaultPanel'>
        <local:NczListBoxPanel x:FieldModifier='nlbp'/>
    </ItemsPanelTemplate>
    <Style TargetType='local:NczListBox'>
        <Setter Property='ItemsPanel2' Value='{StaticResource ResourceKey=defaultPanel}'/>
        <Setter Property='Template'>
            <Setter.Value>
                <ControlTemplate TargetType='local:NczListBox'>
                    <Border x:Name='root' Visibility='{TemplateBinding Property=Visibility}' Projection='{TemplateBinding Property=Projection}' Padding='{TemplateBinding Property=Padding}' OpacityMask='{TemplateBinding Property=OpacityMask}' Opacity='{TemplateBinding Property=Opacity}' VerticalAlignment='{TemplateBinding Property=VerticalAlignment}' HorizontalAlignment='{TemplateBinding Property=HorizontalAlignment}' Width='{TemplateBinding Property=Width}' Height='{TemplateBinding Property=Height}' FlowDirection='{TemplateBinding Property=FlowDirection}' Effect='{TemplateBinding Property=Effect}' DataContext='{TemplateBinding Property=DataContext}'  BorderThickness='{TemplateBinding Property=BorderThickness}' Background='{TemplateBinding Property=Background}' BorderBrush='{TemplateBinding Property=BorderBrush}'>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup>
                                <VisualState x:Name='normal'/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <local:PanelPresentor ItemsPanel='{TemplateBinding ItemsPanel}' x:Name='ip'/>
                        <!--<StackPanel Margin='1' Name='sp'/>-->
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <!--ncz listbox item style-->
    <Style TargetType='local:NczListBoxItem'>
        <Setter Property='Template'>
            <Setter.Value>
                <ControlTemplate TargetType='local:NczListBoxItem'>
                    <Border Width='{TemplateBinding Width}' Height='{TemplateBinding Height}'>
                        <local:DataPresentor x:Name='dp' DataContext='{TemplateBinding Item}' ItemTemplate='{Binding Path=ItemTemplate,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=local:NczListBox}}'/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
